<?php
/**
 * Page Template
 *
 * Loaded automatically by index.php?main_page=product_info.<br />
 * Displays details of a typical product
 *
 */
 require(DIR_WS_MODULES . '/debug_blocks/product_info_prices.php');
?>  

<div class="right_big_con margin_t">
	<div class="title_bg b_link" id="navblock"><?php echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?></DIV>
        <!--bof Product Name-->
        <h1 style="font-size: 16px;" class="mag_10_px"><?php echo $products_name; ?></h1>
        <!--eof Product Name-->

<?php
	if ($products_image_num > 0) {
?>
	<div id="detail_cent">
	<div class="photos">
    <!--bof Main Product Image -->
    <script type="text/javascript">
    <!--
    function showItemLarge(image_url){
        document.getElementById("prod_default_photo").src=image_url;
    }
    -->
    </script>
<?php
/** * display the main product image */

		require($template->get_template_dir('tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
    <!--eof Main Product Image-->
    </div>

	<div class="right">
	          <!--bof Form start-->
      <?php echo zen_draw_form('cart_quantity_frm', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n"; ?>
      <!--eof Form start-->
      <?php echo zen_draw_hidden_field('products_id',$_GET['products_id']); ?>
      <div class="line_180" style="padding-right: 20px;">

        <div class="margin_t">Item #:&nbsp;<?php echo $products_model; ?></div>
          <div class="hr_d"></div>
        <!--bof Product Price block -->
        <div class="b red" style="padding:15px 0;">Price:<span style="padding:0 20px;"><?php echo zen_get_products_display_final_price((int)$_GET['products_id']);?></span></div>
        <!--eof Product Price block -->        
        
      </div>
	  <div class="clear"></div>
      <ul class="g_t_c product_ul_h">
        <?php if ($products_quantity > 0){ ?>
        <strong>Buy: </strong>
        <input type="text" name="cart_quantity" id="cart_quantity" value="<?php echo $products_quantity_order_min;?>" maxlength="6" style="width:30px" /> <strong>Qty</strong>
        <?php }else{ ?>
            <div align="right"><img src="images/soldout.gif" alt="Sold Out" /></div>
        <?php } ?>
      </ul>
      <?php if ($products_quantity > 0){ ?>
      <ul id="selectArea" class="g_t_c product_ul_h relative"></ul>
      <ul class="g_t_c gray" id="tmp_tit"></ul>
			  <script type="text/javascript">
				    function showTit(key){
				    (key==0)?$('tit_t').style.display = '':$('tit_t').style.display = 'none';
				  }
				  
				  function nrcr(){
				    this.ini = init;
				    this.arrSel = [];
				      this.checking = checkS;
				      this.strbuy = '<input type="submit" class="buttonAddCart" alt="Add to Cart" title="Add to Cart" />';     
				  }
				  var sel = new nrcr();
				  
				  function init(){
				    var selects = document.getElementsByTagName("SELECT");
				    for(i=0;i<selects.length;i++){
				      if (selects[i].id.substr(0,7) == 'attrib-')
				          this.arrSel.push(selects[i].id);
				    }
				    var len = this.arrSel.length;
				    if(len>0){
				      $('tmp_tit').innerHTML = 'To Add to Shopping Cart,<br />choose from options to the left.';
				       for(j=0;j<len;j++){
				          $(this.arrSel[j]).onchange = this.checking;
				      }
				      }
				  }
				  
				  function checkS() {
				    var str = sel.strbuy;
				    var errMsg = '';
				    var pass = true;
				    var t = 0;
				    if(sel.arrSel.length > 0){
				      for(i=0;i<sel.arrSel.length;i++){
				        if($(sel.arrSel[i]).value == ""){
				          (t>0)?errMsg = errMsg + ' and ' + $(sel.arrSel[i]).previousSibling.innerHTML.replace(':',''):errMsg += $(sel.arrSel[i]).previousSibling.innerHTML.replace(':','');          
				          pass = false;
				          t++;
				        }           
				      } 
				    }
				    errMsg = "Please select<br />" + errMsg;  
				    if(!pass)
				      str = '<img src="includes/templates/<?php echo $template_dir; ?>/images/button/car.gif" border="0"  onmouseout=showTit(1) onmouseover=showTit(0); />'+'<div id="tit_t" style="display:none">'+errMsg+'<b></b></div>';
				     $('selectArea').innerHTML = str;
				  }
				     
				  </script>
		      <script>sel.ini();sel.checking();</script>
        <?php } ?>
      
      </form><br />
<br />

	<?php echo '<a href="'.zen_href_link(FILENAME_TELL_A_FRIEND, 'products_id='.$_GET['products_id']). '">'.zen_image($template->get_template_dir('tell_a_friends.gif', DIR_WS_TEMPLATE, $current_page_base,'images/button'). '/' . 'tell_a_friends.gif','Tell A Friends','','',' class="relative"').'</a>';?>

	</div>
    </div>

<?php
 // }
?>
	<?php }else{ ?>
    
    <div class="allborder"><img src="<?php echo DIR_WS_PROIMG . $products_image .'.jpg'; ?>" alt="<?php echo $products_name;?>" title="<?php echo $products_name;?>"></div>
    
  <div class="blank"></div>
<!--bof Form start-->
  <?php echo zen_draw_form('cart_quantity_frm', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n"; ?>
  <!--eof Form start-->
  <?php echo zen_draw_hidden_field('products_id',$_GET['products_id']); ?>
  
    <div class="fl" style="width:320px; margin:20px 50px 20px 0;"><div class="fl" style="width:70%">Item #:&nbsp;<?php echo $products_model; ?>      <strong style="padding-left:40px;">Price:</strong></div>
    <div class="fr b red" style="width:30%; text-align:left;"><?php echo zen_get_products_display_final_price((int)$_GET['products_id']);?></div>
  </div>
    <div class="fl" style=" width:300px; margin:20px 0;">
      <?php if ($products_quantity > 0){ ?>
      <span class="fl"><strong>Buy: </strong>
      <input type="text" name="cart_quantity" id="cart_quantity" value="<?php echo $products_quantity_order_min;?>" maxlength="6" style="width:30px"  /> <strong>Qty</strong></span>
      <?php }else{ ?>
          <img src="images/soldout.gif" alt="Sold Out" />
      <?php } ?>
    <?php if ($products_quantity > 0){ ?>
    <span id="selectArea" class="fr" style="margin-top:-6px"></span>
    <ul class="g_t_c gray" id="tmp_tit"></ul>
			<script type="text/javascript">
				    function showTit(key){
				    (key==0)?$('tit_t').style.display = '':$('tit_t').style.display = 'none';
				  }
				  
				  function nrcr(){
				    this.ini = init;
				    this.arrSel = [];
				      this.checking = checkS;
				      this.strbuy = '<input type="submit" class="buttonAddCart" alt="Add to Cart" title="Add to Cart" />';     
				  }
				  var sel = new nrcr();
				  
				  function init(){
				    var selects = document.getElementsByTagName("SELECT");
				    for(i=0;i<selects.length;i++){
				      if (selects[i].id.substr(0,7) == 'attrib-')
				          this.arrSel.push(selects[i].id);
				    }
				    var len = this.arrSel.length;
				    if(len>0){
				      $('tmp_tit').innerHTML = 'To Add to Shopping Cart,<br />choose from options to the left.';
				       for(j=0;j<len;j++){
				          $(this.arrSel[j]).onchange = this.checking;
				      }
				      }
				  }
				  
				  function checkS() {
				    var str = sel.strbuy;
				    var errMsg = '';
				    var pass = true;
				    var t = 0;
				    if(sel.arrSel.length > 0){
				      for(i=0;i<sel.arrSel.length;i++){
				        if($(sel.arrSel[i]).value == ""){
				          (t>0)?errMsg = errMsg + ' and ' + $(sel.arrSel[i]).previousSibling.innerHTML.replace(':',''):errMsg += $(sel.arrSel[i]).previousSibling.innerHTML.replace(':','');          
				          pass = false;
				          t++;
				        }           
				      } 
				    }
				    errMsg = "Please select<br />" + errMsg;  
				    if(!pass)
				      str = '<img src="includes/templates/<?php echo $template_dir; ?>/images/button/car.gif" border="0"  onmouseout=showTit(1) onmouseover=showTit(0); />'+'<div id="tit_t" style="display:none">'+errMsg+'<b></b></div>';
				     $('selectArea').innerHTML = str;
				  }
				     
				  </script>
		    <script>sel.ini();sel.checking();</script>
   <?php } ?>
    </div>
  </form>
  <script>changePrice();</script>
  <!-- EOF ProductShipping Cart-->
<div class="blank"></DIV>	
	<?php echo '<a href="'.zen_href_link(FILENAME_TELL_A_FRIEND, 'products_id='.$_GET['products_id']). '">'.zen_image($template->get_template_dir('tell_a_friends.gif', DIR_WS_TEMPLATE, $current_page_base,'images/button'). '/' . 'tell_a_friends.gif','Tell A Friends','','',' class="relative"').'</a>';?>
  
    <?php } ?>
	    
<div class="blank"></DIV>	
<div id="descript" class="bord1 textj">

  <!--bof Product description -->
  <?php if ($products_description != '') { ?>
    <div><h2 class="blue">Description: </h2>
    <?php echo stripslashes($products_description); ?></div>
  <?php } ?>
  <!--eof Product description -->

</div>

<?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?>

</div>
<div class='right_big_con'><div class=" title_bg mag_10_px"><h2>Related Product Recommended</h2></div>
<?php
/**
 * display the product previous/next helper
 */

require($template->get_template_dir('tpl_product_related.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_product_related.php'); 


?></div>

